﻿@model CustomerModel.SendEmailModel

<div id="sendemail-window" style="display:none;">
    <form asp-area="@Constants.AreaAdmin" asp-controller="Customer" asp-action="SendEmail" method="post" asp-route-id="Id">
        <input type="hidden" asp-for="Id" id="sendemail_customerId"/>
        <div class="form-horizontal">
            <div class="form-body">
                <div class="form-group">
                    <admin-label asp-for="Subject"/>
                    <div class="col-md-9 col-sm-9">
                        <admin-input asp-for="Subject"/>
                        <span asp-validation-for="Subject"></span>
                    </div>
                </div>
                <div class="form-group">
                    <admin-label asp-for="Body"/>
                    <div class="col-md-9 col-sm-9">
                        <admin-textarea asp-for="Body"></admin-textarea>
                        <span asp-validation-for="Body"></span>
                    </div>
                </div>
                <div class="form-group">
                    <admin-label asp-for="SendImmediately"/>
                    <div class="col-md-9 col-sm-9">
                        <admin-input asp-for="SendImmediately"/>
                        <span asp-validation-for="SendImmediately"></span>
                    </div>
                </div>
                <div class="form-group" id="pnl-send-date">
                    <admin-label asp-for="DontSendBeforeDate"/>
                    <div class="col-md-9 col-sm-9">
                        <admin-input asp-for="DontSendBeforeDate"/>
                        <span asp-validation-for="DontSendBeforeDate"></span>
                    </div>
                </div>
            </div>
            <div class="form-actions">
                <div class="offset-md-3 offset-sm-3 col-md-6 col-sm-6">
                    <button type="submit" class="k-button"><span class="k-icon k-i-email"></span>&nbsp;@Loc["Admin.Customers.Customers.SendEmail"]</button>
                </div>
            </div>
        </div>
    </form>
</div>
<script>
    $(document).ready(function () {
        $("#sendemail").click(function (e) {
            e.preventDefault();
            var window = $("#sendemail-window");
            if (!window.data("kendoWindow")) {
                window.kendoWindow({
                    modal: true,
                    width: "650px",
                    title: "@Loc["Admin.Customers.Customers.SendEmail"]",
                    actions: ["Close"]
                });
            }
            window.data('kendoWindow').center().open();
        });


        //timing of send email section
        $("#pnl-send-date").hide();
        
        $("#sendemail-window .check-box").click(function () {
            $("#pnl-send-date").toggle();
        });

    });
</script>